import React, { useState, useEffect } from 'react'
import { Button } from 'antd'
const Child = ({ visivle }: { visivle: boolean }) => {
	useEffect(() => {
		console.log('挂载')
		return () => {
			console.log('卸载')
		}
	}, [])
	return visivle ? '挂载' : '卸载	'
}

const Test: React.FC = () => {
	const [visivle, setVisivle] = useState(true)
	return (
		<div>
			<h1>Test</h1>

			<div>
				<div>{visivle && <Child visivle={visivle} />}</div>
				<Button type='primary' onClick={() => setVisivle(!visivle)}>
					Primary Button
				</Button>
			</div>
		</div>
	)
}

export default Test
